<!--  start table-content  -->
<div id="table-content">

<form action="{bstoRootPath}book/view/" method="post" id="filter_form">
<table border="0" cellpadding="0" cellspacing="0" id="id-form">
	<tr>
		<th valign="top">Book Name</th>
		<td><input id="filter_bname" name="bname" class="inp-form tipper"
			value="{bnameInput}" /></td>

	</tr>
	<tr>
		<th valign="top">Category</th>
		<td><input id="filter_category" name="category" class="inp-form"
			value="{catInput}" /></td>
	</tr>
	<tr>
		<th valign="top">User</th>
		<td>{userInputTag} <!-- input id="filter_user" name="user" class="inp-form" value="{userInput}" /-->
		</td>
	</tr>
	<tr>
		<th></th>
		<td><input id="filter_submit" type="submit" class="form-submit" /></td>
	</tr>
</table>
</form>
<div id="focus_tooltip" style="display: none">Put here what you need to say on focus event.</div>



<!--  start product-table ..................................................................................... -->
<form id="mainform" action="">
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
	<thead id="bstoTableHeader">
		{bstoTableHeader}
	</thead>
	<tbody id="bstoContent">
		{bstoContent}
	</tbody>
</table>
</form>
<!--  end product-table................................... -->
<!--  start paging..............-->
<table border="0" cellpadding="0" cellspacing="0" id="paging-table">
	<tbody id="bstoPaging">
		{bstoPaging}
	</tbody>
</table>
<!--  end paging................-->

</div> <!--  end content-table  -->
<div class="clear"></div>
<script type="text/javascript"><!--       
	
	jQuery(document).ready(function(){		
		$("#filter_bname").autocompleteArray([{bookNameData}]);
		$("#filter_category").autocompleteArray([{categoryData}]);
		$("#filter_user").autocompleteArray([{userData}]);
		
		$("#filter_submit").click(function(){
			//alert('okie');
			$("#filter_form").ajaxForm({
				dataType: 'json',
				success: function(response){	
					//alert('test =' + response.test);
				
					if (response.bstoContent == "") {
						alert("There is no result!");
						//$('#null_table').html('');
						$('#bstoTableHeader').html('');
						$('#bstoContent').html('');	
						$('#bstoPaging').html('<br /><br /><br />');					
					} else {
						$('#bstoTableHeader').html(response.bstoTableHeader);
						$('#bstoContent').html(response.bstoContent);
						$('#bstoPaging').html(response.bstoPaging);	
					}
					
				    			   

				    //after filter
				    $(".icon-2").click(function(event){
				    	if (!confirm("Do you want to delete this book ?")) {
							event.preventDefault();
						}
					});
					$('.styledselect_pages').selectbox({ inputClass: "styledselect_pages" });	
					$(".selectbox-wrapper2 ul li").click(function(){
			    		location.href= bookPath + "/view/1?filter=1&numRows="+$(this).html();
			    		
			    	});
				},
				beforeSubmit: function(){
				},
				clearForm:false			
			});
		});		
	});
</script>
<script type="text/javascript">
jQuery(document).ready(function(){
    	$(".selectbox-wrapper2 ul li").click(function(){
    		//alert( $.cookie("filter2") );
    		if ($.cookie("filter2") == 1) {
    			location.href=bookPath + "/view/1?filter=1&numRows="+$(this).html();
    		} else {
    			location.href=bookPath + "/view/1?numRows="+$(this).html();
    		}    		
    	});
});
</script>
